﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Configuration;

namespace LINQ_Example
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        private static string _connectionString = null;
        
        public static string ConnectionString
        {
            get
            {
                if (_connectionString==null)
                {
                    string connectionStringName = ConfigurationManager.AppSettings["defaultCS"];
                    _connectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
                }
                return _connectionString;
            }
        }

        public static void RefreshConnection()
        {
            _connectionString = null;
        }

    }
}
